home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11113 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: newshost.cyberramp.net!news
  2. From: sinan@cyberramp.net (John Noland)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: fflush and Visual C++
  5. Date: 22 Mar 1996 00:37:33 GMT
  6. Organization: Prose Software
  7. Message-ID: <4issod$jkf@newshost.cyberramp.net>
  8. References: <4idhv5$dnv@news.mhv.net> <314b173b.71056173@nntp.ix.netcom.com> <4ifuuf$fha@solutions.solon.com>
  9. NNTP-Posting-Host: ramp1-6.cyberramp.net
  10. X-Newsreader: WinVN 0.99.5
  11.  
  12. In article <4ifuuf$fha@solutions.solon.com>, seebs@solutions.solon.com says...
  13. >
  14. >In article <314b173b.71056173@nntp.ix.netcom.com>,
  15. >Mike Rubenstein <miker3@ix.netcom.com> wrote:
  16. >>Perhaps because Visual C implements fflush() correctly.  fflush() does
  17. >>not flush input buffers.  fflush() with stdin as an argument results
  18. >>in undefined behavior.
  19. >
  20. >The first part of this is incorrect.  fflush() may flush input buffers.
  21. >It may cause the program to abort.  It may do nothing.  But there's
  22. >nothing *wrong* with it choosing to discard pending input when invoked
  23. >on an input stream.  Except that it's rude of an implementation to offer
  24. >a silent extension, it causes people to make mistakes.
  25.  
  26. Sorry to keep getting myself in trouble, but...
  27.  
  28. With Micrsoft's Visual C compiler, if the stream is open for input, fflush()
  29. clears the contents of the buffer. I don't have any thoughts on the ANSIness
  30. of this behavior, but that's the way the manual says it works. It also says
  31. the fflush() function negates the effect of any prior call to ungetc() against
  32. the stream. And then it has the mark saying this function is ANSI compliant.
  33. I gather PS's remarks about rudeness are correct?
  34.  
  35. -John
  36.  
  37.